typedef D3DXVECTOR2 Point;

class cSprite;
class cVertices
{
	friend cSprite;
	public:

		cVertices(const cSprite&);
		void SetPosition (D3DXVECTOR2)const;
		void SetLeft(bool)const;
		void SetRect(float,float,float,float)const;
		void SetScale(float)const;
		void SetAngle(float)const;
		void SetColor(D3DCOLOR)const;

	protected:
		sVertex* GetVertices()const;		
		sVertex* GetVerticesRight()const;
		sVertex* GetVerticesLeft()const;

	private:
		const cSprite& sprite;

		mutable bool left;
		mutable D3DXVECTOR2 pos;
		mutable float u1,v1,u2,v2;
		mutable float scale,angle;
		mutable D3DCOLOR color;
};

class cSprite
{
	public:
		
		cSprite();
		static void SetDevice(IDirect3DDevice9*);
		bool LoadFromFile(const char*);
		void Render()const;
		int GetX()const;
		int GetY()const;
		void Release();
		~cSprite();
		
		cVertices Vertices;
		void DrawAt(int x,int y);
		void Draw();

	private:

		static IDirect3DDevice9* device;

	protected:

		IDirect3DTexture9* tex;
		IDirect3DVertexBuffer9* vb;
		int sizeX,sizeY;
		
};
